home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Gamer (Italian) 36
/
PC Gamer IT CD 36 2-2.iso
/
VIGDEMO
/
data1.cab
/
Assets
/
scripts
/
lift.e
< prev
next >
Wrap
Text File
|
1998-09-21
|
2KB
|
180 lines
int Initialize(string type) {
global int gProperty;
global int state;
global real timeScratch;
Reset("dummy");
}
int Reset(string dummy)
{
CloseLowLevel();
state = 2;
SetProperty(thisObject,"mType",100);
SetProperty(thisObject,"door",100);
gProperty = GetProperty(thisObject,"mType");
}
int Event(int input)
{
real time;
real elapsedTime;
time = GetTime(thisObject);
elapsedTime = time - timeScratch;
switch (state)
{
case 1:
{
if (input == 2)
{
timeScratch = time;
state = 4;
CloseLowLevel();
}
else if (input == 1)
{
timeScratch = time;
}
else if (elapsedTime>3.0)
{
timeScratch = time;
state = 4;
CloseLowLevel();
}
}
break;
case 2:
if (input == 1)
{
timeScratch = time;
state = 3;
OpenLowLevel();
}
break;
case 3:
if (elapsedTime>1.5)
{
state = 1 ;
timeScratch = time;
AnimSetPhase(thisObject,1.0);
}
Run(thisObject);
break;
case 4:
if (elapsedTime>1.5)
{
timeScratch = time;
state = 2 ;
AnimSetPhase(thisObject,0.0);
}
Run(thisObject);
break;
case 5:
break;
default:
break;
}
}
int Open(string dummy)
{
Event(1);
}
int OpenLowLevel ()
{
AnimSetPhase(thisObject,0.0);
AnimSetDirection(thisObject,0);
}
int CloseLowLevel ()
{
AnimSetPhase(thisObject,1.0);
AnimSetDirection(thisObject,1);
return 0;
}
int StopLowLevel ()
{
return 0;
}